<?php

class SectionForm extends CFormModel {

	public $sectionId;
	public $sectionType = 0;
	public $originalSection;
	public $sectionSort = 0;
	public $isPost = 0;
	public $chapterId;
	public $translateId;
	public $addTime;
	public $commentsCounts;
	public $titleParent = 0;
	public $leftX = 0;
	public $olStart=1;

	public $sectionText;

	public $isAdd = true;

	public function rules() {
		return array(
			array('sectionType, sectionText, originalSection, sectionSort, leftX, olStart', 'required', 'on'=>'create'),
			array('sectionText', 'required', 'on'=>'translate'),
			array('sectionType, originalSection, sectionSort, olStart', 'required', 'on'=>'update'),
			array('sectionType, originalSection, sectionText, chapterId, translateId, addTime, commentsCounts', 'safe', 'on'=>'update, translate'),
		    array('sectionSort, titleParent, leftX, olStart', 'numerical', 'integerOnly'=>true),
			// 安全
			array('sectionId, sectionSort, leftX, olStart' , 'safe'),
		);
	}

	public function attributeLabels() {
		return array(
			'sectionType'=>'段落类型',
			'originalSection'     =>'原书内容',
			'sectionSort'     =>'段落排序',
			'isPost'     =>'可否评论',
			'sectionText' => '翻译内容',
			'titleParent' => '父标题id',
			'leftX'=>'左侧缩进倍数',
			'olStart'=>'有序列表起始数'
		);
	}


}
?>
